# encoding: utf-8
#
#  xbayRAMDiskAppDelegate.py
#  xbayRAMDisk
#
#  Created by ? ? on 08-1-1.
#  Copyright __MyCompanyName__ 2008. All rights reserved.
#

from Foundation import *
from AppKit import *
from ramdisk import *
import os

class xbayRAMDiskAppDelegate(NSObject):
    # 要mount的磁盘大小
    disksize = 800
    # disk的名称
    diskname = ""

    def applicationDidFinishLaunching_(self, sender):
        NSLog("Application did finish launching.")

    def mountdisk_(self, sender):
        status,output = initRAMDisk(self.disksize)
        if status==0 :
            self.diskname = output
        else:
            NSLog("hdid error is:%s"%output)
            return
        status,output = newfs(self.diskname)
        if status != 0 :
            NSLog("newfs error is:%s"%output)
            return
        status,output = mountfs(self.diskname)
        if status != 0 :
            NSLog("mount error is:%s"%output)
            return
        